package cn.hpclub.server.controller.h5;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.jfinal.core.Controller;
import com.jfinal.kit.StrKit;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;

import cn.hpclub.server.model.MemberOrg;
import cn.hpclub.server.model.Notice;

public class NoticeH5Controller extends Controller{
    private static final Logger logger = LoggerFactory.getLogger(NoticeH5Controller.class);

    /**
     * 获取宽带预约数据列表
     */
    public void list(){
        int pageNumber = getParaToInt("pageNumber", 1);
        int pageSize = getParaToInt("pageSize", 10);
        String storeMasterId = getPara("storeMasterId"); // 实际就是userid
        int orgId = 0;
        if(StrKit.notBlank(storeMasterId)){
            orgId = MemberOrg.dao.getOrgIdById(Integer.valueOf(storeMasterId));
        }
        // System.out.println("storeMasterId:" + storeMasterId + ",orgId:" +
        // orgId);
        String keyword = getPara("keyword");
        Page<Record> pager = Notice.dao.getNoticeList(pageNumber, pageSize, keyword, orgId);
        renderJson(pager);
    }

}
